package com.fanxuankai.boot.canal.listener.autoconfigure;

import com.fanxuankai.boot.canal.listener.CanalTableCache;
import com.fanxuankai.boot.canal.listener.MessageListener;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author fanxuankai
 */
@Configuration
@EnableConfigurationProperties(CanalListenerProperties.class)
@ConditionalOnProperty(name = CanalListenerProperties.ENABLED, matchIfMissing = true)
public class CanalListenerAutoConfiguration {
    @Bean
    public MessageListener messageListener() {
        return new MessageListener();
    }

    @Bean
    public CanalTableCache canalTableCache() {
        return new CanalTableCache();
    }
}
